<#include "app/task/filters/filter-for-all-work-plan-list.ftl">

<table class="work-plan-list" data-page="${page}" data-page-size="${pageSize}" data-count="${count}">
	<tr class="title-row">
		<th class="text-center" width="45">序号</th>
		<th class="text-center">合同编号</th>
		<th class="text-center">合同名称</th>
		<th class="text-center">工作内容</th>
		<th class="text-center">里程碑</th>
		<th class="text-center">开始时间</th>
		<th class="text-center">结束时间</th>
		<th class="text-center">责任人</th>
		<th class="text-center">计划变更</th>
		<th class="text-center">执行情况</th>
		<th class="text-center">备注</th>
	</tr>
	<#if data??> <#list data as p>
	<!--  -->
	<#assign url=((p.contract.mainContract)?string('contract','sub-contract'))!'contract'>
	<tr class="${((p.completed)?string('text-deleted text-danger',''))}" style="cursor: pointer;" onclick="window.open('${request.contextPath}/${url}/view/${p.contract.id}','_blank');">
		<td class="text-center">${p_index+1}</td>
		<td class="text-center">${p.contract.no}</td>
		<td class="text-center">${p.contract.name}</td>
		<td class="text-center">${p.work}</td>
		<td class="text-center">${p.milestone.value}</td>
		<td class="text-center">${(p.startDatePoint?string('yyyy-MM-dd'))!'-'}</td>
		<td class="text-center">${(p.datePoint?string('yyyy-MM-dd'))!'-'}</td>
		<td class="text-center">${p.header}</td>
		<td class="text-center">${(p.changed?string('已变更','未变更'))!'-'}</td>
		<td class="text-center">${((p.completed)?string('已执行','未执行'))}</td>
		<td class="text-center">
			${(p.remark?replace('\n','
			<br>
			'))!'-'}
		</td>
	</tr>
	</#list> </#if>
</table>

<script src="${request.contextPath}/js/suredy-datetimepicker.js"></script>
<script src="${request.contextPath}/js/suredy-list.js"></script>
<script src="${request.contextPath}/core/js/jquery.form.js"></script>
<script type="text/javascript">
	$(function() {
		// 初始化时间控件
		$.suredy.datetimepicker.init();

		var doSearch = function(page, pageSize) {
			var form = $('form.filter-form');

			form.ajaxSubmit({
				dataType : 'html',
				data : {
					page : page,
					pageSize : pageSize
				},
				success : function(html, textStatus, jqXHR) {
					if (!html)
						return false;

					$('div.suredy-content').html(html);
				},
				error : function(jqXHR, textStatus, errorThrown) {
					return false;
				}
			});
		};

		$('.work-plan-list').list({
			header : false,
			paginate : function(page, pageSize, key) {
				doSearch(page, pageSize);
			}
		});

		$('.filter-search').on('click', function() {
			doSearch(1, $('table.work-plan-list').data('page-size'));
		});

		$('.filter-reset').on('click', function() {
			$('form.filter-form input').val('');
			$('form.filter-form option:first-child').prop('selected', true);
		});
	});
</script>
